// import echarts from 'echarts'
import echarts from 'echarts/lib/echarts'
export const GaugeOption = {
    tooltip: {
      formatter: "{a} <br/>{b} : {c}%"
    },
    grid: {
      bottom: '0',
      top: 20,
      left: 20,
      right: 20
    },
    series: [{
      name: '百分比',
      type: 'gauge',
      splitNumber: 5,
      splitLine: {
        show: false
      },
      axisTick: {
        show: false
      },
      pointer: {
        length: '70%'
      },
      itemStyle: {
        color: '#fff'
      },
      axisLabel: {
        distance: -45,
        color: '#fff'
      },
      axisLine: {
        show: true,
        lineStyle: { // 属性lineStyle控制线条样式
          color: [
            [0.5, new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
              offset: 0.9,
              color: "#0BA1FF" // 50% 处的颜色
            }, {
              offset: 0.13,
              color: "#FF5E46" // 40% 处的颜色
            }], false)],

            [1, new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              offset: 0.03,
              color: "#0BA1FF" // 92% 处的颜色
            }, {
              offset: 0.6,
              color: "#6CF893" // 90% 处的颜色
            }], false)]
          ],
          width: 15 //表盘宽度
        }
      },
      detail: {
        formatter: '{value}%',
        color: '#0B92E7',
        fontSize: 14,
        fontWeight:400,
        offsetCenter: [0, '65%']
      },
      title: {
        color: '#fff',
        fontSize: 14,
        fontWeight:400,
        offsetCenter: [0, '100%']
      },
      data: [{value:50,name:'经济发展'}]
    }]
  };

  export const LineOption = {
    tooltip: {
      trigger: 'axis',
      axisPointer: { // 坐标轴指示器，坐标轴触发有效
        type: 'line' // 默认为直线，可选为：'line' | 'shadow'
      }
    },
    xAxis: {
      type: 'category',
      // boundaryGap: false,
      data: ['经济发展', '创新驱动', '民生保障', '生态环境'],
      axisLabel: {
        textStyle: {
          color: 'rgba(255,255,255,0.58)'
        },
        show: true,
        interval: 0,
        formatter: function (params) {
          var newParamsName = "";
          var paramsNameNumber = params.length;
          var provideNumber = 4; //一行显示几个字
          var rowNumber = Math.ceil(paramsNameNumber / provideNumber);
          if (paramsNameNumber > provideNumber) {
            for (var p = 0; p < rowNumber; p++) {
              var tempStr = "";
              var start = p * provideNumber;
              var end = start + provideNumber;
              if (p == rowNumber - 1) {
                tempStr = params.substring(start, paramsNameNumber);
              } else {
                tempStr = params.substring(start, end) + "\n";
              }
              newParamsName += tempStr;
            }

          } else {
            newParamsName = params;
          }
          return newParamsName
        },
      },
      axisLine: {
        show: true,
        lineStyle: {
          color: 'rgba(255,255,255,0.22)'
        }
      }
    },
    grid: {
      bottom: 35,
      top: 20,
      left: 50,
      right: 20
    },
    yAxis: {
      type: 'value',
      splitLine: {
        lineStyle: {
          color: 'rgba(255,255,255,0.22)'
        }
      },
      axisLine: {
        lineStyle: {
          color: 'rgba(255,255,255,0.22)'
        }
      },
      axisLabel: {
        textStyle: {
          color: 'rgba(255,255,255,0.58)'
        }
      }
    },
    series: [{
      name: '增幅',
      data: [820, 934, 1330, 1000],
      type: 'bar',
      barWidth: 20,
      textStyle: {
        color: '#fff'
      },
      itemStyle: {
        normal: {
          color: new echarts.graphic.LinearGradient(
            0, 0, 0, 1,
            [{
                offset: 0,
                color: '#10C7E7'
              },
              {
                offset: 1,
                color: '#2944BE'
              }
            ]
          )
        }
      }
    }]
  }